using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pool;
using Random = UnityEngine.Random;

public class PoolSlimes : PoolBase<Slimes>
{

    private void Awake()
    {

        Initialize();
    }

    protected override Slimes OnCreatePoolItem()
    {
        var obj = base.OnCreatePoolItem();
        obj.SetDeactivateAction(delegate { Release(obj); });

        return obj;
    }

    protected override void OnGetPoolItem(Slimes obj)
    {
        base.OnGetPoolItem(obj);
        obj.transform.position = transform.position + Random.insideUnitSphere * 2f;
    }

    public void SetPrefab(Slimes prefab) 
    {
        this.prefab = prefab;
    }
}
